package org.advanced.security;

/**
 * @author John.zhang
 * @version Id: Synchronize, v 1.0 2020/12/8 17:16 ZhiYong Exp $
 */
public class Synchronize {

    /**
     * 类级别的锁,锁的是当前类对象
     */
    public synchronized static void synchronizeA(){

    }
    public void synchronizeAA(){
        //可灵活伸缩锁
        synchronized (Synchronize.class){

        }
    }

    /**
     * 对象锁
     */
    public void synchronizeB(){
        //可灵活伸缩锁
        synchronized (this){

        }
    }

    /**
     * 锁的是当前实例对象
     */
    public synchronized void synchronizeBB(){

    }

}
